<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">            <!-- 从XML根元素开始匹配 -->
        <html>
            <head>
                <title>沐言科技：www.yootk.com</title>
            </head>
            <body>
                <xsl:choose>                <!-- 判断语法 -->
                    <xsl:when test="members/member">    <!-- 指定节点是否存在 -->
                        <table border="1">
                            <thead>
                                <tr>
                                    <td>id</td>
                                    <td>姓名</td>
                                    <td>年龄</td>
                                    <td>图书</td>
                                </tr>

                            </thead>

                            <tbody>
                                <xsl:for-each select="members/member">    <!-- 数据迭代 -->
                                    <tr>
                                        <td>
                                            <xsl:value-of select="@id"/>
                                        </td>
                                        <td>
                                            <xsl:value-of select="name"/>
                                        </td>
                                        <td>
                                            <xsl:value-of select="age"/>
                                        </td>
                                        <td>
                                            <xsl:value-of select="book"/>
                                        </td>
                                    </tr>
                                </xsl:for-each>
                            </tbody>
                        </table>
                    </xsl:when>
                </xsl:choose>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
